#!/bin/bash

#################################
#测试脚本
#################################

set -x

function check()
{
    wget https://github.com/google/double-conversion/archive/refs/tags/v3.0.0.tar.gz
    tar -xvf v3.0.0.tar.gz
    cd double-conversion-3.0.0
    cmake . -DBUILD_TESTING=ON
    make
    test/cctest/cctest --list | tr -d '<' | xargs test/cctest/cctest
    if [[ $? -eq 0 ]];then
        echo "RETURN SUCCESS"
    else
        echo "RETURN FAILED"
    fi
}

function main()
{
    ret=$(check)
    if [[ $ret == *'RETURN SUCCESS' ]];then
        echo "test scripts success"
    else
        echo "test scripts failed"
    fi
}
main

